//
//  LianxirenViewController.m
//  即时通讯
//
//  Created by MK-MAC-001 on 15/9/21.
//  Copyright © 2015年 客官大大. All rights reserved.
//

#import "LianxirenViewController.h"
#import "LianTableViewCell.h"
#import "ChatListViewController.h"
#import <RongIMKit/RCConversationViewController.h>
@interface LianxirenViewController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation LianxirenViewController

- (void)viewDidLoad {
    [super viewDidLoad];
       [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}];
    UIImage *im = [UIImage imageNamed:@"图片(1)"];
    UIImageView *o = [[UIImageView alloc] initWithFrame:CGRectMake(500, 0, 150, 50)];
    o.image = im;
    self.navigationItem.titleView = o;
    UIImage *image1 = [UIImage imageNamed:@"iconfont-jiahao"];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:image1 style:UIBarButtonItemStyleDone target:self action:@selector(dede)];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
    self.view.backgroundColor = [UIColor colorWithRed:240.0/255.0 green:240.0/255.0 blue:240.0/255.0 alpha:1];
    UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 568) style:UITableViewStylePlain];
    table.delegate = self;
    table.dataSource = self;
           table.separatorStyle = UITableViewCellSeparatorStyleNone;//  分割线
    table.backgroundColor = [UIColor clearColor];
    [self.view addSubview:table];
    // Do any additional setup after loading the view from its nib.
}
-(void)dede
{
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    RCConversationViewController *conversationVC = [[RCConversationViewController alloc]init];
    conversationVC.conversationType =ConversationType_PRIVATE;
    conversationVC.targetId = @"2"; //这里模拟自己给自己发消息，您可以替换成其他登录的用户的UserId
    conversationVC.userName = @"客官大大";
    conversationVC.title = @"biu";
    conversationVC.hidesBottomBarWhenPushed=YES;
    
    [self.navigationController pushViewController:conversationVC animated:YES];
}
- (void)getUserInfoWithUserId:(NSString *)userId completion:(void(^)(RCUserInfo* userInfo))completion
{
    //此处为了演示写了一个用户信息
    if ([@"1" isEqual:userId]) {
        RCUserInfo *user = [[RCUserInfo alloc]init];
        user.userId = @"1";
        user.name = @"客官大大";
        user.portraitUri = @"https://ss0.baidu.com/73t1bjeh1BF3odCf/it/u=1756054607,4047938258&fm=96&s=94D712D20AA1875519EB37BE0300C008";
        
        return completion(user);
    }else if([@"2" isEqual:userId]) {
        RCUserInfo *user = [[RCUserInfo alloc]init];
        user.userId = @"2";
        user.name = @"测试2";
        user.portraitUri = @"https://ss0.baidu.com/73t1bjeh1BF3odCf/it/u=1756054607,4047938258&fm=96&s=94D712D20AA1875519EB37BE0300C008";
        return completion(user);
    }
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *indent = @"cell";
    LianTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indent];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"LianTableViewCell" owner:self options:nil]lastObject];
                  [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
//    if (indexPath.section == 0) {
////        cell.name.text = @"大连东软信息学院";
//
//        UIImage *image = [UIImage imageNamed:@"9a504fc2d56285355d9828c590ef76c6a6ef63de.jpg"];
//        cell.touxiang.image = image;
//    }
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

    return 100;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
